package com.taotao.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.pojo.EasyUITreeNote;
import com.taotao.pojo.TaotaoResult;
import com.taotao.service.ContentCategoryService;

@Controller
@RequestMapping("/content/category")
public class ContentCategoryController {
	
	@Autowired
	private ContentCategoryService contentCategoryService;

	@RequestMapping("/list")
	@ResponseBody
	public List<EasyUITreeNote> getContentCatList(@RequestParam(value="id",defaultValue="0") Long parentId) {
		
		List<EasyUITreeNote> list = contentCategoryService.getContentCategoryList(parentId);
		
		return list;	
	}
	
	@RequestMapping("create")
	public TaotaoResult addContenCat(Long parentId,String name)
	{
		TaotaoResult result = contentCategoryService.addContentCat(parentId, name);
		return result;
	}
}
